home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / c / date.lha / Date / C / src / Date.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-01  |  7.3 KB  |  104 lines

  1. #ifdef _AMIGA
  2.    #define _ISO8859_Latin1
  3. #endif
  4. #ifndef BOOLEAN
  5.   typedef short bool;
  6.   #define true    1
  7.   #define false    0
  8.   #define BOOLEAN
  9. #endif
  10. #ifndef DATELIB
  11.   typedef enum{dayerr,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday} Weekdays;
  12.   typedef enum{NewMoon,FirstQuarter,FullMoon,LastQuarter} MoonPhases;
  13.   #define DATELIB
  14. #endif
  15. #ifndef LOCALE
  16.   typedef enum{Locale,English,Deutsch,
  17.                #ifdef _ISO8859_Latin1
  18.                  français,español
  19.                #else
  20.                  francais,espanol
  21.                #endif
  22.               } Languages;
  23.   #define LOCALE
  24. #endif
  25.  
  26. /* Module initialization */
  27. #ifndef __SASC_650
  28.   void _DateInit(void);
  29.   #undef __MakeLib
  30. #endif
  31.  
  32. #ifndef __MakeLib
  33.   bool JulianLeapYear(const int year);
  34.   bool GregorianLeapYear(const int year);
  35.   bool HeisLeapYear(const int year);
  36.   unsigned short JulianMonthDays(const unsigned short month, const int year);
  37.   unsigned short GregorianMonthDays(const unsigned short month, const int year);
  38.   unsigned short HeisMonthDays(const unsigned short month, const int year);
  39.   unsigned int JulianYearDays(const int year);
  40.   unsigned int GregorianYearDays(const int year);
  41.   unsigned int HeisYearDays(const int year);
  42.   short CompareDates(const unsigned short day1, const unsigned short month1, const int year1, const unsigned short day2, const unsigned short month2, const int year2);
  43.   long JulianDayDiff(const unsigned short day1, unsigned short month1, int year1, const unsigned short day2, unsigned short month2, int year2);
  44.   long GregorianDayDiff(const unsigned short day1, unsigned short month1, int year1, const unsigned short day2, unsigned short month2, int year2);
  45.   long HeisDayDiff(const unsigned short day1, unsigned short month1, int year1, const unsigned short day2, unsigned short month2, int year2);
  46.   Weekdays JulianWeekday(const unsigned short day, unsigned short month, int year);
  47.   Weekdays GregorianWeekday(const unsigned short day, unsigned short month, int year);
  48.   Weekdays HeisWeekday(const unsigned short day, unsigned short month, int year);
  49.   unsigned short JulianDaysBeforeWeekday(const unsigned short day, const unsigned short month, const int year, const Weekdays weekday);
  50.   unsigned short GregorianDaysBeforeWeekday(const unsigned short day, const unsigned short month, const int year, const Weekdays weekday);
  51.   unsigned short HeisDaysBeforeWeekday(const unsigned short day, const unsigned short month, const int year, const Weekdays weekday);
  52.   unsigned short JulianDaysAfterWeekday(const unsigned short day, const unsigned short month, const int year, const Weekdays weekday);
  53.   unsigned short GregorianDaysAfterWeekday(const unsigned short day, const unsigned short month, const int year, const Weekdays weekday);
  54.   unsigned short HeisDaysAfterWeekday(const unsigned short day, const unsigned short month, const int year, const Weekdays weekday);
  55.   void JulianDiffDate(const unsigned short day, const unsigned short month, const int year, int days, unsigned short *dday, unsigned short *dmonth, int *dyear);
  56.   void GregorianDiffDate(const unsigned short day, const unsigned short month, const int year, int days, unsigned short *dday, unsigned short *dmonth, int *dyear);
  57.   void HeisDiffDate(const unsigned short day, const unsigned short month, const int year, int days, unsigned short *dday, unsigned short *dmonth, int *dyear);
  58.   unsigned int JYearToScaliger(const int year);
  59.   unsigned int GYearToScaliger(const int year);
  60.   unsigned int HYearToScaliger(const int year);
  61.   int ScaligerYearToJ(const unsigned int syear);
  62.   int ScaligerYearToG(const unsigned int syear);
  63.   int ScaligerYearToH(const unsigned int syear);
  64.   unsigned long JSYearToJD(const unsigned int syear);
  65.   unsigned long GSYearToJD(const unsigned int syear);
  66.   unsigned long HSYearToJD(const unsigned int syear);
  67.   unsigned long JDtoMJD(const unsigned long jd);
  68.   unsigned long MJDtoJD(const unsigned long mjd);
  69.   unsigned long JulianToJD(const unsigned short day, const unsigned short month, const int year);
  70.   unsigned long GregorianToJD(const unsigned short day, const unsigned short month, const int year);
  71.   unsigned long HeisToJD(const unsigned short day, const unsigned short month, const int year);
  72.   float TimeToJD(const unsigned short hour, const unsigned short min, const unsigned short sec);
  73.   void JDToTime(float jd, unsigned short *rhour, unsigned short *rmin, unsigned short *rsec);
  74.   unsigned short GregorianMoonAge(const unsigned short day, const unsigned short month, const int year);
  75.   void GregorianEaster(const int year, unsigned short *dday, unsigned short *dmonth);
  76.   short TimeZoneFactor(const short degree);
  77.   long LMT(const unsigned long secs, const float meridiandegree, const float posdegree);
  78.   unsigned long TimeToSec(const unsigned short hour, const unsigned short min, const unsigned short sec);
  79.   void SecToTime(unsigned long secs, unsigned short *hour, unsigned short *min, unsigned short *sec);
  80.   unsigned short JulianWeek(const unsigned short day, const unsigned short month, const int year);
  81.   unsigned short GregorianWeek(const unsigned short day, const unsigned short month, const int year);
  82.   unsigned short HeisWeek(const unsigned short day, const unsigned short month, const int year);
  83.   unsigned short WeekdayText(Weekdays wday, char *wtext, Languages lang);
  84.   unsigned short MonthText(unsigned short month, char *mtext, Languages lang);
  85.   unsigned short WeekdayShortText(Weekdays wday, char *wtext, Languages lang);
  86.   unsigned short MonthShortText(unsigned short month, char *mtext, Languages lang);
  87.   void JDToJulian(const unsigned long jd, unsigned short *day, unsigned short *month, int *year);
  88.   void JDToGregorian(const unsigned long jd, unsigned short *day, unsigned short *month, int *year);
  89.   void JDToHeis(const unsigned long jd, unsigned short *day, unsigned short *month, int *year);
  90.   void JulianEaster(const int year, unsigned short *dday, unsigned short *dmonth);
  91.   void HeisEaster(const int year, unsigned short *dday, unsigned short *dmonth);
  92.   unsigned long GregorianMoonPhase(const unsigned short day, const unsigned short month, const int year, const MoonPhases phase);
  93.   short CompareTimes(const unsigned short hour1, const unsigned short min1, const unsigned short sec1, const unsigned short hour2, const unsigned short min2, const unsigned short sec2);
  94.  
  95.   /* This are old routines that should not longe be used! They appear here only for compatibility to old releases! */
  96.   bool JulianDaySmaller(const unsigned short day1, const unsigned short month1, const int year1, const unsigned short day2, const unsigned short month2, const int year2);
  97.   bool GregorianDaySmaller(const unsigned short day1, const unsigned short month1, const int year1, const unsigned short day2, const unsigned short month2, const int year2);
  98.   bool HeisDaySmaller(const unsigned short day1, const unsigned short month1, const int year1, const unsigned short day2, const unsigned short month2, const int year2);
  99.   bool JulianDayGreater(const unsigned short day1, const unsigned short month1, const int year1, const unsigned short day2, const unsigned short month2, const int year2);
  100.   bool GregorianDayGreater(const unsigned short day1, const unsigned short month1, const int year1, const unsigned short day2, const unsigned short month2, const int year2);
  101.   bool HeisDayGreater(const unsigned short day1, const unsigned short month1, const int year1, const unsigned short day2, const unsigned short month2, const int year2);
  102. #else
  103. #endif
  104.